package com.itheima.controller;

import com.itheima.pojo.EmpDto;
import com.itheima.pojo.LoginInfo;
import com.itheima.pojo.Result;
import com.itheima.service.EmpService;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpSession;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author: zhengsuyang
 * @Desc:
 * @create: 2025-09-12 10:00
 **/
@RestController
@Slf4j
public class LoginController {
    @Autowired
    private EmpService empService;

    /**
     * 登录功能
     * @param empDto
     * @return
     */
    @PostMapping("/login")
    public Result login(@RequestBody EmpDto empDto, HttpSession session){
        LoginInfo loginInfo = empService.login(empDto);
//        session.setAttribute("loginUser",loginInfo);
        return Result.success(loginInfo);
    }
}
